package com.gmail.blackdog1987.carcare.network.request.builder;

import android.content.Context;

import com.gmail.blackdog1987.carcare.Constant;
import com.gmail.blackdog1987.carcare.db.dao.UserDao;
import com.gmail.blackdog1987.carcare.network.request.RequestBuilder;
import com.gmail.blackdog1987.carcare.util.DeviceUtils;
import com.gmail.blackdog1987.carcare.util.LogUtil;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public class GasValidCardRequestBuilder extends RequestBuilder {

	private static final String TAG = GasValidCardRequestBuilder.class.getSimpleName();
	private String code;
	
	@Override
	public RequestParams buildRquest() {
		RequestParams params = new RequestParams();
		params.put("code", code);
		return params;
	}
	
	public GasValidCardRequestBuilder setCode(String code){
		this.code = code;
		return this;
	}

	@Override
	public void postJsonRequest(Context context, AsyncHttpResponseHandler handler) {

		RequestParams params = buildRquest();
		
		AsyncHttpClient client = new AsyncHttpClient();
		client.setTimeout(Constant.TIMEOUT);
		client.setUserAgent(DeviceUtils.OS.getName());
		
		client.post(Constant.Action.GAS_VALIDCARD, params, handler);
		LogUtil.d(TAG, "post : " + params);
	}

}
